package com.example.practice.service.impl;

import com.example.practice.entity.Rule;
import com.example.practice.dao.RuleDao;
import com.example.practice.service.RuleService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;

/**
 * (Rule)表服务实现类
 *
 * @author makejava
 * @since 2023-12-25 22:47:48
 */
@Service("ruleService")
public class RuleServiceImpl implements RuleService {
    @Resource
    private RuleDao ruleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param aid 主键
     * @return 实例对象
     */
    @Override
    public Rule queryById(Integer aid) {
        return this.ruleDao.queryById(aid);
    }



    /**
     * 新增数据
     *
     * @param rule 实例对象
     * @return 实例对象
     */
    @Override
    public Rule insert(Rule rule) {
        this.ruleDao.insert(rule);
        return rule;
    }

    /**
     * 修改数据
     *
     * @param rule 实例对象
     * @return 实例对象
     */
    @Override
    public Rule update(Rule rule) {
        this.ruleDao.update(rule);
        return this.queryById(rule.getId());
    }

    @Override
    public Rule queryByAId(Integer id) {
        return this.ruleDao.queryByAId(id);
    }

    @Override
    public Rule queryByName(String name) {return this.ruleDao.queryByName(name);}


}
